package utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by public1 on 2017/1/10.
 */

public class CacheUtils {

    /**
     * @param context
     * @param key
     * @param values
     */
    public static void cacheString(Context context,String key,String values) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("tikeyc",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit().putString(key,values);
        editor.commit();
    }

    /**
     * @param context
     * @param key
     * @return
     */
    public static String getCacheString(Context context,String key) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("tikeyc",Context.MODE_PRIVATE);
        String value = sharedPreferences.getString(key,"");//无值 则返回""
        return value;
    }


}
